#ifndef EAPPLICATION_H
#define EAPPLICATION_H

#include "Engine_global.h"
class ETextureManager;
class EGraphicsObjectManager;
class EInputManager;

#include "graphics/erenderer.h"
class EGraphicsObject;

class ENGINESHARED_EXPORT EApplication : public QObject
{
    Q_OBJECT
public:
    explicit EApplication(QObject *parent = 0);

    static EApplication& app();
    
    virtual bool init(int resWidth = 800, int resHeight = 600, bool bFullscreen = false);
    virtual void destroy();
    virtual void run();
    virtual void update(float dt);
    virtual void render();

    boost::shared_ptr<ETextureManager> textureManager() const;
    boost::shared_ptr<EGraphicsObjectManager> graphicsObjectManager() const;
    boost::shared_ptr<EInputManager> inputManager() const;

    float toGraphicsCoordinates(float value);
    float toPhysicsCoordinates(float value);

    const QPointF& resoultionScale() const;
private:
    bool initManagers();
    boost::shared_ptr<ETextureManager> m_textureManager;
    boost::shared_ptr<EGraphicsObjectManager> m_graphicsObjectManager;
    boost::shared_ptr<EInputManager> m_inputManager;
    ERenderer m_renderer;

    bool m_bRunning;
    float m_fPrevTime;

    float m_fPhysicsScaleFactor;
    QPoint m_basicResolution;
    QPointF m_resolutionScale;
signals:
    
public slots:
    
};

#endif // EAPPLICATION_H
